#include "c_Resource.h"
#include "c_ResourceMgr.h"
#include "c_SpriteResource.h"
#include "c_TextureResource.h"
#include "c_Engine.h"

namespace wiigi
{
   
   const std::string c_Resource::d_DefaultGroup = "Default";
   const std::string c_Resource::d_DefaultName  = "FooBar";

   c_Resource::c_Resource( c_ResourceMgr* ResourceMgr ) :
   m_ResourceMgr( ResourceMgr ),
   m_Engine( wiigi::c_Engine::getInstance() ),
   m_Name( d_DefaultName ),
   m_Group( d_DefaultGroup )
   {
      //printf( "c_Resource()\n" );
   }
      
   c_Resource::~c_Resource(void)
   {
      //printf( "~c_Resource()\n" );
   }
   
   bool c_Resource::setParameter( const std::string& ParameterName, const std::string& ParameterValue )
   {
      bool Supported;
      Supported = true;
      
      if( ParameterName == "name" )
      {
         setName( ParameterValue );
      }
      else if( ParameterName == "group" )
      {
         setGroup( ParameterValue );
      }
      else
      {
         Supported = false;
      }
               
      return Supported;
   }
   
   c_Resource* c_Resource::createResource( c_ResourceMgr* ResourceMgr, const std::string& ResourceType )
   {
      c_Resource* Resource( 0 );
      
      if( ResourceType == "sprite" )
      {
         Resource = new c_SpriteResource( ResourceMgr );
      }
      else if(  ResourceType == "texture" )
      {
         Resource = new c_TextureResource( ResourceMgr );
      }

      return Resource;
   }


}

